//引入接口
import {reqAddressInfo,reqOrderInfo} from '@/api'
const state = {
    address:[],
    orderInfo:{}
}
const mutations = {
    GETUSEADDRESS(state, address) {
        state.address = address
    },
    GETORDERINFO(state, orderInfo) {
        state.orderInfo = orderInfo
    },
}
const actions = {
    //退出登录删除信息
    async getuseaddress({ commit }) {
        let result = await reqAddressInfo()
        if (result.code == 200) {
            commit("GETUSEADDRESS",result.data)
            return 'ok'
        } else {
             return Promise.reject(new Error('faile'))
        }
    },
    //退出登录删除信息
    async getOrderInfo({ commit }) {
        let result = await reqOrderInfo()
        if (result.code == 200) {
            commit("GETORDERINFO",result.data)
            return 'ok'
        } else {
             return Promise.reject(new Error('faile'))
        }
    },

}
const getters = {

}
export default {
    state,
    mutations,
    actions,
    getters
}